home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 3
/
Cream of the Crop 3.iso
/
clipper
/
ks94an.zip
/
2COMP.HDR
< prev
next >
Wrap
Text File
|
1994-04-25
|
873b
|
40 lines
/******************************************************************************
The Klipper Library, for CA-Clipper 5.x
Copyright (c), 1994, Wallace Information Systems Engineering
FUNCTION:
_2Comp( cBinNum ) --> c2CompStr
PARAMETERS:
cBinNum : Character String - Binary Number to 2's complement.
SHORT:
Perform a binary 2's compliment.
DESCRIPTION:
_2comp() perfroms a 2's compliment on a binary number.
The cBinNum must be passed as a character string in order to preserve
significant leading zeros, because:
00101 = 11011 (2's comp) = 27
101 = 011 (2's comp) = 3
The leading zeros are significant in a 2's compliment.
NOTE:
EXAMPLE:
? _2comp('11010101') // '00101011'
? _2comp('010101') // '101011'
******************************************************************************/